<header>
    <hgroup>
        <h1>Ville de {$data.2}</h1>
        <h2>Code postal : {$data.3}</h2>
    </hgroup>
</header>

{if $data.4 == '0'}
Aucune données GPS disponible pour localisation
{else}
    <div id="maps" class="singleMap">
    </div>
   {strip}
    <script>
        {literal}
        var GoogleMap = {
            zoom: 12,
            id: 'maps',
            markers :
            [
                { latitude: {/literal}{$data.4}{literal},
                  longitude: {/literal}{$data.5}{literal},
                  html: {/literal}"{$data.2}"{literal} }
                {/literal}
                    { foreach from=$chasseurs item=chasseur }
                        {literal},{
                            latitude: {/literal}{$chasseur.lat}{literal},
                            longitude: {/literal}{$chasseur.lng},{literal}
                            html: "Chasseur {/literal}{$chasseur.prenom}{literal}",
                            icon: {
                                image: "{/literal}{$SYS_FOLDER}{literal}themes/macrise/images/gmap_pin_orange.png",
                                iconsize: [26, 46],
                                iconanchor: [12,46],
                                infowindowanchor: [12, 0]
                            }
                            }
                        {/literal}
                    {/foreach}
                    {if $shops|is_object }
                        { foreach from=$shops item=shop }
                            {literal},{
                                latitude: {/literal}{$shop.lat}{literal},
                                longitude: {/literal}{$shop.lng},
                                html: "Magasin <a href='{$BASE_URL}stores/{$shop._id}-{$shop.name|replace:' ':'-' }{literal}'>{/literal}{$shop.name}{literal}</a> <br /> {/literal}{$shop.adress}{literal}",
                                icon: {
                                    image: "{/literal}{$SYS_FOLDER}{literal}themes/macrise/images/gmap_pin.png",
                                    iconsize: [26, 46],
                                    iconanchor: [12,46],
                                    infowindowanchor: [12, 0]
                                }
                                }
                            {/literal}
                        {/foreach}
                    {/if}
                {literal}
            ]
        }
        {/literal}
    </script>
    {/strip}

{/if}


<section id="infos_ville">
    <div>
        <h2>Magasins</h2>
        <ul>
            { assign var=i value=1 }
            {if $shops|is_object }
                { foreach from=$shops item=shop }
                <li>
                    <span>{ $i++  }</span>
                    <a href='{$BASE_URL}stores/{$shop._id}-{$shop.name|replace:' ':'-' }'>{$shop.name}</a>
                </li>
                {/foreach}
            {/if}
        </ul>
    </div>
    <div>
        <h2>Chasseurs</h2>
        <ul>
            { assign var=i value=1 }
            { foreach from=$chasseurs item=chasseur }
            <li>
                <span>{ $i++  }</span>
                <a href='{$BASE_URL}hunters/{$chasseur._id}-{$chasseur.nom|replace:' ':'-' }-{$chasseur.prenom|replace:' ':'-' }'>{$chasseur.prenom}</a>
            </li>
            {/foreach}
        </ul>
    </div>
    <div>
        <h2>Relevé</h2>
        <ul>
            { assign var=i value=1 }
            { foreach from=$releves item=releve }
            <li>
                <a href='{$BASE_URL}reports/{$releve->product->_id}-{$releve->product->name|replace:' ':'-' }'>{$releve->product->name} - {$releve->prix} €</a>
            </li>
            {/foreach}
        </ul>
    </div>
</section>

<section class="commentaires">
    <header>
        <h1>Commentaires</h1>
    </header>

    <ul>
        { if $coms }
        { foreach from=$coms item=com }
        <li class="commentaire">
            <span class="date">{ $com.date_create|date_format:"%d/%m/%Y" }</span>
            
            <span class="message">
                <span class="user">{ $com.user->prenom } { $com.user->nom }</span>
                { $com.message }
            </span>
        </li>
        { /foreach }
        { else }
        <li class="commentaire">
            <span class="message">Aucun commentaire pour le moment...</span>
        </li>
        { /if }
        
        { if $user_connected }
        <li class="commentaire">
            <form method="post" action="{ $HTTP_HOST_REQUEST }">
                <input type="hidden" name="todo" value="Commentaire" />
                <input type="hidden" name="object_id" value="{ $data.0 }" />

                <span class="date">
                    <button type="submit">
                        <img src="{ $BASE_URL }themes/macrise/images/plus.png" width="32" height="32" alt="Ajouter" />
                    </button>
                </span>

                <span class="message">
                    <textarea name="message" placeholder="Votre message"></textarea>
                </span>
            </form>
        </li>
        { /if }
    </ul>
</section>